﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Drawing;

public partial class reco_manage : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        DBaccess db = new DBaccess();
        DataSet ds = new DataSet();
        ds = db.GetDataSet("select value from mr_parameter where pname='sim'");
        String getMid = HttpContext.Current.Request.QueryString["mid"];
        if (getMid == null) getMid = "2";
        int i;
        MyVector mvall = new MyVector(int.Parse(getMid));
        MyVector mvreco = new MyVector();
        MyVector mvnoreco = new MyVector();
        mvall.Recommand(double.Parse(ds.Tables[0].Rows[0][0].ToString()));
        mvall.Sort();
        mvreco = mvall.GetRecommand();
        mvnoreco = mvall.GetNoRecommand();
        for (i = 0; i < mvnoreco.GetLength(); i++)
        {
            Label lab = new Label();
            lab.Width = 195;
            if (i % 4 == 2 || i % 4 == 3) lab.BackColor = Color.FromArgb(255,255,150);
            lab.Text = mvnoreco.GetIname(i) + ":" + mvnoreco.GetValue(i).ToString("0.00");
            Panel2.Controls.Add(lab);
        }
        for (i = 0; i < mvreco.GetLength(); i++)
        {
            Label lab = new Label();
            lab.Width = 195;
            if (i % 4 == 2 || i % 4 == 3) lab.BackColor = Color.FromArgb(255, 255, 150);
            lab.Text = mvreco.GetIname(i) + ":" + mvreco.GetValue(i).ToString("0.00");
            Panel3.Controls.Add(lab);
        }
        if (mvnoreco.GetLength() == 0)
        {
            Label lab = new Label();
            lab.Width = 195;
            lab.Text = "无已评分的课程";
            Panel2.Controls.Add(lab);
        }
        if (mvreco.GetLength() == 0)
        {
            Label lab = new Label();
            lab.Width = 195;
            lab.Text = "所有课程都已评分";
            Panel3.Controls.Add(lab);
        }
    }

}